package cn.ycl.auth.biz.rolemenu.controller;

import cn.ycl.auth.biz.rolemenu.entity.RoleMenu;
import cn.ycl.auth.biz.rolemenu.service.RoleMenuService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 角色和菜单关联表(RoleMenu)表控制层
 *
 * @author yuanchangliang
 * @since 2021-09-30 17:31:23
 */
@RestController
@RequestMapping("roleMenu")
public class RoleMenuController {
    /**
     * 服务对象
     */
    @Resource
    private RoleMenuService roleMenuService;

    /**
     * 通过主键查询单条数据
     *
     * @param roleId 主键
     * @return 单条数据
     */
    @GetMapping("getMenuByRoleId")
    public List<RoleMenu> getMenuByRoleId(Long roleId) {
        return this.roleMenuService.queryByRoleId(roleId);
    }

    /**
     * 获取前10条数据
     *
     * @return 单条数据
     */

    @GetMapping("selectAll")
    public List<RoleMenu> selectAll() {
        return this.roleMenuService.queryAllByLimit(0, 10);
    }

}
